package com.five.welcome.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.five.welcome.dao.OrdersMapper;
import com.five.welcome.entity.Orders;
import com.five.welcome.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ywt
 * @since 2024-07-12
 */
@Service
public class OrderServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService {
    @Autowired
    private OrdersMapper ordersMapper;

    @Override
    public Orders getOrderBySNumber(String sNumber) {
        QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("s_number", sNumber);
        return ordersMapper.selectOne(queryWrapper);
    }

    @Override
    public List<Orders> selectAll(Orders orders) {
        QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("*");
        return ordersMapper.selectList(queryWrapper);
    }


    @Override
    public Orders getOrderByOrderId(String orderId) {
        QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("order_id", orderId);
        return ordersMapper.selectOne(queryWrapper);
    }
}
